#!/bin/sh -vx
# $Id$
# Public domain. Originally written by Martin Ruckert
# Basic check that rule.tex can be hitexed stretched and shrinked.

LC_ALL=C; export LC_ALL;  LANGUAGE=C; export LANGUAGE

TEXMFCNF=$srcdir/../kpathsea; export TEXMFCNF
TEXINPUTS=$srcdir/hitexdir/tests; export TEXINPUTS
TFMFONTS=$srcdir/tests; export TFMFONTS
T1FONTS=$srcdir/tests; export T1FONTS

# separate from hitexdir/tests because automake writes hello.log
# in hitexdir/tests (so it already exists).
OUTDIR=./hitexdir/tests/outdir; mkdir $OUTDIR

#./hitex --help >/dev/null  || exit $?
./hitex --version || exit $?

./hitex -ini -interaction=nonstopmode -output-directory=$OUTDIR hello.tex \
|| exit $?

./histretch $OUTDIR/hello.hnt || exit $?

if grep "<section 3 .*cmr10.tfm'>" \
        $OUTDIR/hello.hint >/dev/null; then
  : # OK
else
  echo "hello.hint does not contain the proper <section with" \
       " cmr10.tfm, goodbye." >&2
  exit 1
fi

exit 0
